/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SIMRS.RawatInap.sql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author Regoes
 */
public class koneksiDatabase {
 private static Connection koneksi;

    public static Connection getKoneksi(){
        if(koneksi == null){
            try {
                String url = "jdbc:mysql://localhost:3306/buahhati";
                String username = "root";
                String password = "";
                DriverManager.registerDriver(new com.mysql.jdbc.Driver());
                koneksi = DriverManager.getConnection(url, username, password);
                System.out.println("Aplikasi Terhubung dengan database");
            } catch (SQLException ex) {
                System.out.println("Tidak Bisa Koneksi ke Database");
            }
        }
        return koneksi;
    }
    
    
}
